<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <%@ page contentType="text/html;charset=utf-8" language="java" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@taglib uri="/struts-tags" prefix="s" %>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>audio model activity search</title>
    <link rel="stylesheet" type="text/css" href="../resource/css/screen.css"/>
    <link href="${pageContext.request.contextPath}/resource/css/uploadify.css"
          rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/jquery-1.4.2.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/swfobject.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/resource/js/jquery.uploadify.v2.1.0.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/upload.js"></script>

</head>

<body>
<div class="wrap">
    <div class="header">
        <div class="logo">
            <a href="#"><img alt="logo" src="../resource/images/brand.gif"/></a>
        </div>
        <ul id="nav">
            <li class="nav_image"><a title="picture" href="${pageContext.request.contextPath}/sz/pictureTab.action"><img
                    alt="picture"
                    src="../resource/images/image.gif"/></a>
            </li>
            <li class="nav_video"><a title="video" href="${pageContext.request.contextPath}/sz/videoTab.action"><img
                    alt="video" src="../resource/images/video.gif"/></a>
            </li>
            <li class="nav_audio"><a title="audio" href="${pageContext.request.contextPath}/sz/audioTab.action"><img
                    alt="audio" src="../resource/images/audio.gif"/></a>
            </li>
            <li class="nav_model"><a title="model" href="${pageContext.request.contextPath}/sz/modelTab.action"><img
                    alt="model" src="../resource/images/model.gif"/></a>
            </li>
            <li class="nav_action nav_current"><a title="activity"
                                                  href="${pageContext.request.contextPath}/sz/activityTab.action"><img
                    alt="activity"
                    src="../resource/images/action.gif"/></a></li>
        </ul>


        <div id="content">

            <form id="key_form" method="get" target="upload_target"
                  action="${pageContext.request.contextPath}/sz/activityNameSearch.action">
                <div class="inputbox">
                    <div class="input_radio">
                    </div>
                </div>
                <div class="key_search">
                    <input class="key_t" name="activity.title" type="text"/>
                    <input class="key_b" value="" type="submit"/>
                </div>
                <div style="clear:both;"></div>
            </form>

        </div>
    </div>
    <div class="content">
        <div class="sidebar">
            <img src="../resource/images/pic_top.gif" alt="图片分类列表"/>
            <ul id="pictureType">
                <c:forEach var="top" items="${types}">
                    <li title="${top.typeId }">
                        <a class="side_list" href="#">${top.name}</a>
                        <a class="side_del" title="${top.typeId}" href="#"><img alt="delete"
                                                                                src="../resource/images/cha.gif"/></a>
                    </li>
                </c:forEach>
            </ul>
        </div>

        <div class="audio_s_main" style="float:left;">
            <c:forEach var="top" items="${resultSet.list}">
                <div class="video_show">
                    <c:choose>
                        <c:when test="${'Audio'==resultSet.type}">
                            <img src="../resource/images/audio_show.jpg"/>
                        </c:when>
                        <c:otherwise>
                            <img alt="video_search"
                                 src="${top.minPictureUrl}"/>
                        </c:otherwise>
                    </c:choose>
                    <table class="video_detail">
                        <tr class="video_title">
                            <td colspan="2">${top.title}</td>
                        </tr>
                        <tr>
                            <td class="td_title">文件类型：</td>
                            <td>${top.fileType}</td>
                        </tr>
                        <tr>
                            <td class="td_title">文件大小：</td>
                            <td>${top.size }KB</td>
                        </tr>
                        <tr>
                            <td class="td_title">站&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;点：</td>
                            <td>${top.server} </td>
                        </tr>
                        <tr>
                            <td class="td_title">描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述：</td>
                            <td>${top.note}</td>
                        </tr>
                    </table>

                </div>
            </c:forEach>
            <div class="clear"></div>
        </div>
    </div>

    <div class="pages">
        <div id="search_con">
            <input type="hidden" name="actionName"
                   value="${pageContext.request.contextPath}/sz/${resultSet.actionName}.action">
            <input type="hidden" name="type" value="${resultSet.type}">
            <input type="hidden" name="keyWord" value="${resultSet.keyWords}">
            <input type="hidden" name="idList" value="${resultSet.idList}">
            <c:choose>
                <c:when test="${!empty resultSet.pageInfo.currentPage}">
                    <input type="hidden" name="currentPage" value="${resultSet.pageInfo.currentPage}">
                </c:when>
                <c:otherwise>
                    <input type="hidden" name="currentPage" value="0">
                </c:otherwise>
            </c:choose>
            <c:choose>
                <c:when test="${!empty resultSet.pageInfo.totalPage}">
                    <input type="hidden" name="totalPage" value="${resultSet.pageInfo.totalPage}">

                    <p id="pages_num" class="pages_num">
                        <a class="point" href=""><img alt="previousPages" src="../resource/images/prepoint_l.gif"/></a>
             <span>
             </span>
                        <a class="point" href=""><img alt="forwardPages" src="../resource/images/prepoint_r.gif"/></a>
                    </p>

                    <p class="pages_sum">
                        Pages:<span>${resultSet.pageInfo.currentPage}</span>&#47;<span>${resultSet.pageInfo.totalPage}</span>
                    </p>
                </c:when>
                <c:otherwise>
                    <input type="hidden" name="totalPage" value="0">
                </c:otherwise>
            </c:choose>

        </div>
    </div>

    <div class="footer">
        <span>&copy;</span><span>电子科技大学数字媒体技术研究所</span><span>All rights reserved</span>
        <span>&#124;</span><span>Powered by Dreamfly</span>
    </div>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/top_nav.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        var $search_con = $("#search_con");
        var url = $search_con.find("input[name=actionName]").val();
        var keyWord = $search_con.find("input[name=keyWord]").val();
        var ids = $search_con.find("input[name=idList]").val();
        var current_i = $("input[name=currentPage]").val();
        var totalPage = $("input[name=totalPage]").val();
        if (ids) {
            ids = ids.replace(/,/g, "&szTypeIds=");
        }
        var numIndex = [];
        if (parseInt(totalPage) <= 5) {
            var indexFlag = parseInt(totalPage);
            for (var i = 0; i < indexFlag; i++) {
                numIndex.unshift(indexFlag - i);
            }
        } else if (parseInt(current_i) <= 3) {
            numIndex = numIndex.concat(1, 2, 3, 4, 5);
        } else if (parseInt(current_i) + 2 >= totalPage) {
            var indexFlag = parseInt(totalPage);
            numIndex = numIndex.concat(indexFlag - 4, indexFlag - 3, indexFlag - 2, indexFlag - 1, indexFlag);
        } else {
            var indexFlag = parseInt(current_i);
            numIndex = numIndex.concat(indexFlag - 2, indexFlag - 1, indexFlag, indexFlag + 1, indexFlag + 2);
        }
        var docFra = document.createDocumentFragment();
        for (var i = 0; i < numIndex.length; i++) {
            var in_a = document.createElement("a");
            in_a.href = url + "?page=" + numIndex[i] + "&activity.title=" + keyWord;
            in_a.innerHTML = numIndex[i];
            if (ids) {
                in_a.href += "&szTypeIds=" + ids;
            }
            if (numIndex[i] == current_i) {
                $(in_a).addClass("current");
            }
            docFra.appendChild(in_a);
        }
        document.getElementById("pages_num").getElementsByTagName("span")[0].appendChild(docFra);
        $("#pages_num a.point").each(function(i) {
            if (i == 0) {
                this.href = url + "?page=" + numIndex[0] + "&activity.title=" + keyWord;
                if (ids) {
                    this.href += "&szTypeIds=" + ids;
                }
            } else {
                this.href = url + "?page=" + numIndex[numIndex.length - 1] + "&activity.title=" + keyWord;
                if (ids) {
                    this.href += "&szTypeIds=" + ids;
                }
            }
        });
    });

</script>
</body>
</html>
